import request from "@/plugins/request";

var pre = "";
if (process.env.NODE_ENV !== "development") {
  pre = "/api/sa/conv-access";
}

// 我的拜访列表
export function pageForMy(data) {
  return request({
    url: `${pre}/visitors/pageForMy`,
    method: "post",
    data,
  });
}

// 新增访客信息
export function addVisitors(data) {
  return request({
    url: `${pre}/visitors/add`,
    method: "post",
    data,
  });
}

// 拜访信息详情
export function getById(visitorsId) {
  return request({
    url: `${pre}/visitors/get?visitorsId=${visitorsId}`,
    method: "get",
  });
}

// 获取被访人访客中心
export function queryInterviewerByCorpIdList(interviewerCorpId = '') {
  return request({
    url: `${pre}/visitorscenter/queryInterviewerByCorpIdList?interviewerCorpId=${interviewerCorpId}`,
    method: "post",
  });
}

// 根据访客中心查询访客参数配置详情
export function getByCenterId(centerId) {
  return request({
    url: `${pre}/visitorsconfig/getByCenterId?centerId=${centerId}`,
    method: "get",
  });
}

// 根据身份证查询访客来访记录(用于照片回显)
export function getPhotoByCertNo(centerId, visitorCertNo) {
  return request({
    url: `${pre}/visitors/getPhotoByCertNo?centerId=${centerId}&visitorCertNo=${visitorCertNo}`,
    method: "get",
  });
}

// 根据身份证查询访客来访记录(用于限制来访次数)
export function getLimitByCertNo(centerId, visitorCertNo) {
  return request({
    url: `${pre}/visitors/getLimitByCertNo?centerId=${centerId}&visitorCertNo=${visitorCertNo}`,
    method: "get",
  });
}

// 黑名单校验
export function getBlackListByCertNo(centerId, certNo) {
  return request({
    url: `${pre}/visitorsblacklist/getByCertNo?centerId=${centerId}&certNo=${certNo}`,
    method: "get",
  });
}